package com.uzai.common.enums;

/**
 * @Auther: jianghan
 * @Date: 2022/3/25 13:49
 * @Description:
 */
public enum RewardLogicEnum {
    BY_USER(0,"根据购买者的会员类型设置的比例给其他关联人分佣"),
    BY_RELATION(1,"根据分佣人各自的会员类型取各自的来自买家返利佣金的比例（悠哉2.0逻辑）");
    private Integer value;
    private String desc;

    public static final int BY_USER_VALUE = 0;
    public static final int BY_RELATION_VALUE = 1;

    RewardLogicEnum(Integer value, String desc) {
        this.value = value;
        this.desc =desc;
    }

    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static RewardLogicEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (RewardLogicEnum type: RewardLogicEnum.values()) {
            if (type.getValue().intValue() == id) {
                return type;
            }
        }
        return null;
    }
}
